<template>
  <el-container>
    <el-header>
      <vxe-input v-model="inputtext"
                 size="small"
                 class="bk_samll_search"
                 placeholder="选择内容"
                 :readonly="1 == 1"
                 @click="openSearch">
        <template v-slot:suffix>
          <!-- @suffix-click="openSearch" -->
          <i class="vxe-icon--caret-bottom"
             @click="openSearch"></i>
        </template>
      </vxe-input>
      <el-input width="300"
                v-model="inputtext"
                placeholder="选择内容"
                :readonly="1 == 1">
        <i slot="suffix"
           class="el-input__icon el-icon-search"
           @click="openSearch" />
      </el-input>
      </vxe-modal>
    </el-header>

    <dic-panel key=""
               :open.sync="showDicPanel"
               :value="inputvalue"
               :callback="searchValue"
               :params="dicparam"
               :dickey="dickey"></dic-panel>
    <el-main>
      <!-- <TreeSelect2 :option="treeSelectConfig" /> -->
    </el-main>

  </el-container>
</template>
<script>
import dicPanel from "./dicPanel";
import TreeSelect2 from "@/components/psTree/treeSelect2"
import functionSelector from '@/components/FunctionSelector/FunctionSelector'
import { getRealUrl } from "@/utils/httpRequet"
export default {
  components: {
    dicPanel, TreeSelect2
  },
  data () {

    return {
      treeSelectConfig: {
        dicKey: 'test',
        multiple: true,
        dataUrl: getRealUrl("sltjDicTree", true, { urlparam: ["$CLS$TBJJ$TEST1$0304"] }),
        beforeLoad: this.treeBeforeLoad,
        dataFilter: this.dataFilter
      },
      val: '',
      myFunc: false,
      inputtext: "",
      inputvalue: "厦门市",
      showDicPanel: false,
      dickey: '$CLS$TBJJ$45b463e0-af27-af46-ac58-12a3369d4c18',
      dicparam: { root: "", as: "32", multiple: false },
    };
  },
  methods: {
    treeBeforeLoad (param, node) {
      if (node.id == undefined) {
        return { p0: '0', p1: "TBJJ" }
      } else {
        return { p0: node.id, p1: "TBJJ" };
      }
    },
    dataFilter (data) {
      for (let i = 0; i < data.length; i++) {
        data[i].isLeaf = data[i].leaf == '1';
      }
      return data;
    },
    funClick (val, name) {
      this.val = name + '：' + val
    },
    openSearch () {
      this.showDicPanel = true;
    },
    searchValue (valInfo, param) {
      this.inputvalue = valInfo.value;
      this.inputtext = valInfo.dispalyVal;

    },
  },
};
</script>